<!DOCTYPE html>
<html lang="zh-CN">

	<meta http-equiv="X-UA-Compatible" content="IE=Edge" charset="utf-8">
	<script src="pages/hplus/js/jquery.min.js"></script>
	<script src="pages/bootstrap/sweetalert/sweetalert.min.js"></script>  
	<link rel="stylesheet" href="pages/bootstrap/sweetalert/sweetalert.css">
  <head>
    <title>远程专家后端平台登录界面</title>
	
	
	<style>
		#firstboundary{
			width:1200px;
			height:305px;
			margin:0 auto;
			margin-top:15%;
			background-image:url("pages/images/logo/logo.png");
			background-repeat:no-repeat;
			background-position:center;
		}
		
	
		#usernameinput{
			width:360px;
			height:45px;
			margin-left:595px;
			margin-top:45px;
			padding-left:10px;
			font-size:18px;
			font-family:微软雅黑; 
			color:#444444;
			border-radius: 5px; 
			border:1px;
			background-image:url("pages/images/logo/ico_user_pr.png");
			background-position:320px center;
			background-repeat:no-repeat;
		}
		
		#passwordinput{
			width:360px;
			height:45px;
			margin-left:595px;
			margin-top:40px;
			margin-top:20px;
			padding-left:10px;
			font-size:18px;
			font-family:微软雅黑; 
			color:#444444;
			border-radius: 5px; 
			border:1px;
			background-image:url("pages/images/logo/ico_code_pr.png");
			background-position:320px center;
			background-repeat:no-repeat;
		}
	
		#submitbtn{
			width:360px;
			height:45px;
			margin-left:595px;
			margin-top:20px;
			background-color:#03A9F4;
			border:0px;
			font-size:24px;
			color:#ffffff;
		}
		
		#checkboxtext{
			position: relative;
			top: 2px;
		}
		
		#wenzitext{
			margin-left:0px;
			font:18px;
			color:#bebebe;
			font-family:微软雅黑; 
		}
		
		#links{
			margin-left:180px;
			font:18px;
			font-family:微软雅黑; 
			color:#bebebe;
			text-decoration:none;
		}
		
		#nameofnonediv{
			margin-top:4.8%;
			margin-right:7%;
			display:none;
			position: relative;
		}
		
		.errortext{
			font-size:22px;
			color:#ffffff;
			position: relative;
			margin-left: 0px;	
		}
		
		.errorimg{
			margin-left: 20px;	
			font-family:微软雅黑; 
		}

	</style>
	
  </head>
  

  <body bgcolor="#03A9F4" style="overflow:hidden">
    <div id="firstboundary">
		<div id="formtext">
			<form align="left" >
				<div >
					<input id="usernameinput" type="text" placeholder="请输入账号"/>
					<img id="errorimg1" src="pages/images/logo/error.png";width="17" height="17" class="errorimg"/>
					<text id="errortext1" class="errortext">账号不能为空</text>
				</div>
				
				<div >
					<input id="passwordinput" class="inline" type="password"  placeholder="请输入密码"/>
					<img id="errorimg2" src="pages/images/logo/error.png";width="17" height="17" class="errorimg"/>
					<text id="errortext2" class="errortext">密码不能为空</text>
				</div>
					
				 <div style="padding-top: 10px;padding-left: 590px;">
					 <input id="checkboxtext" type="checkbox" style="position: relative;top: 1px;"/>
					 <a id="wenzitext">记住密码</a>
					 <a id="links" >忘记密码?</a>
				</div> 
				
				<div>
					<input id="submitbtn" type="button" onclick="checklogin()" value="登录"></button>
				</div>
			</form>
		</div>
	</div>
  </body>
  
	<script>
$(document).ready(function(){
	$("#errorimg1").hide();
	$("#errortext1").hide();
	$("#errorimg2").hide();
	$("#errortext2").hide();
})
function checklogin(){
	var username=$("#usernameinput").val(); 
	var password=$("#passwordinput").val(); 
	$("#errorimg1").hide();
	$("#errortext1").hide();
	$("#errorimg2").hide();
	$("#errortext2").hide();
	if(username == null||username == ""){	
		$("#errorimg1").show();
		$("#errortext1").show();
		document.getElementById("usernameinput").focus();
	}else if(password == null||password==""){
		document.getElementById("errortext2").innerHTML = "密码不能为空";
		$("#errorimg2").show();
		$("#errortext2").show();
		document.getElementById("passwordinput").focus();
	}else{
		$.ajax({
	        type: "post",
	        dataType: "json",
	        url: 'login/login',
	        data:{
	        	username:$("#usernameinput").val(),
	        	password:$("#passwordinput").val()
	        },
	        success: function (data) {
	        	if(data.status=="0"){
	        		document.getElementById("errortext2").innerHTML = data.msg;
	        		$("#errorimg2").show();
	        		$("#errortext2").show();
	        	}else{
	        		window.location.href = "index.jsp";
	        	}
	        },
			error:function(){
				document.getElementById("errortext2").innerHTML = data.msg;
        		$("#errorimg2").show();
        		$("#errortext2").show();
			}
	    });
	}
}
	</script>


</html>